package com.ethannhu.todaynews.component.login


import androidx.lifecycle.ViewModelProvider
import com.drake.channel.sendEvent
import com.ethannhu.todaynews.AppContext
import com.ethannhu.todaynews.activity.BaseTitleActivity
import com.ethannhu.todaynews.component.register.RegisterActivity
import com.ethannhu.todaynews.config.Config
import com.ethannhu.todaynews.databinding.ActivityLoginBinding


class LoginActivity : BaseLoginActivity<ActivityLoginBinding>() {
    override fun initData() {
        super.initData()
        if (Config.DEBUG) {
            binding.username.setText("13141111222")
            binding.password.setText("ixueaedu")
        }

    }

    override fun initListeners() {
        super.initListeners()
        binding.primary.setOnClickListener {
            loginViewModel.login(binding.username.text.toString().trim(), binding.password.text.toString().trim())
        }

        binding.register.setOnClickListener {
            startActivity(RegisterActivity::class.java)
        }
    }
}